#pragma once

class CMainConf : public CDialogImpl<CMainConf>
	, public CWinDataExchange<CMainConf>
{
public:
	enum { IDD=IDD_DIALOG_CONF_MAIN };
	
	LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);

	void OnFinalMessage(HWND wnd)
	{
		delete this;
	}

	LRESULT OnClose(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);

	LRESULT OnBnClickedOk(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);

	LRESULT OnBnClickedCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);

	LRESULT OnBnClickedButtonPrefProvider(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);

	bool SaveConfiguration();

	lyric_provider_ptr GetCurrentLyricProvider();

	BEGIN_MSG_MAP(CMainConf)
		COMMAND_HANDLER(IDC_BUTTON_PREF_PROVIDER, BN_CLICKED, OnBnClickedButtonPrefProvider)
		COMMAND_HANDLER(IDOK, BN_CLICKED, OnBnClickedOk)
		COMMAND_HANDLER(IDCANCEL, BN_CLICKED, OnBnClickedCancel)
		MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
		MESSAGE_HANDLER(WM_CLOSE, OnClose)
	END_MSG_MAP()

	BEGIN_DDX_MAP(CMainConf)
		DDX_CONTROL_HANDLE(IDC_COMBO_PROXYTYPE, m_combo_proxytype)
		DDX_CONTROL_HANDLE(IDC_COMBO_PREF_PROVIDER, m_combo_providers)
	END_DDX_MAP()

private:
	CComboBox m_combo_proxytype;
	CComboBox m_combo_providers;
};
